<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="utf-8">
	<title>添加用户</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="resources/layui/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="resources/layui/css/public.css" media="all" />
	<style>
		input:disabled{
			background-color: white!important;
			border:none;
		}
	</style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width: 100%;" id="dataFrm">
	<div style="margin-left:15%">
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">用户名:</label>
			<div class="layui-input-block">
				<input class="layui-input lname" name="lname" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">真实姓名:</label>
			<div class="layui-input-block">
				<input class="layui-input rname" name="rname" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">年龄:</label>
			<div class="layui-input-block">
				<input class="layui-input age" name="age" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">性别:</label>
			<div class="layui-input-block gender">
				<input class="layui-input gender" name="gender" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">地址:</label>
			<div class="layui-input-block">
				<input class="layui-input address" name="address" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">手机号:</label>
			<div class="layui-input-block">
				<input class="layui-input phone" name="phone" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">部门:</label>
			<div class="layui-input-block">
				<input class="layui-input dept" name="dept" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">职位:</label>
			<div class="layui-input-block">
				<input class="layui-input post" name="post" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">生日:</label>
			<div class="layui-input-block">
				<input class="layui-input birthday" name="birthday" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">身份证:</label>
			<div class="layui-input-block">
				<input class="layui-input card" name="card" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">入职时间:</label>
			<div class="layui-input-block">
				<input class="layui-input entryTime" name="entryTime" disabled="disabled">
			</div>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">状态</label>
			<div class="layui-input-block isDisable">
				<input class="layui-input isDisable" name="isDisable" disabled="disabled">
			</div>
		</div>
	</div>
</form>
<script type="text/javascript" src="resources/layui/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table;
        upload=layui.upload;

        //生日框的时间插件绑定
        laydate.render({
            elem: ".birthday" //指定元素
        });

        //入职时间框的时间插件绑定
        laydate.render({
            elem:".entryTime"
        });

        $(function () {
            getData();
        });
        function  getData() {
            $.ajax({
                type: "GET",
                dataType: 'text',
                url: "/user/userInfos",
                data: {},
                cache: false,
                async: true,
                success: function (data) {
                    var data = eval('(' + data + ')');
                    $('#dataFrm').contents().find(".lname").val(data.lname);
                    $('#dataFrm').contents().find(".rname").val(data.rname);
                    $('#dataFrm').contents().find(".age").val(data.age);
                    $('#dataFrm').contents().find(".gender").val(data.gender=="M"?"男":"女");
                    $('#dataFrm').contents().find(".address").val(data.address);
                    $('#dataFrm').contents().find(".phone").val(data.phone);
                    $('#dataFrm').contents().find(".dept").val(data.dept.name);
                    $('#dataFrm').contents().find(".post").val(data.post.name);
                    $('#dataFrm').contents().find(".birthday").val(data.birthday);
                    $('#dataFrm').contents().find(".card").val(data.card);
                    $('#dataFrm').contents().find(".entryTime").val(data.entryTime);
                    $('#dataFrm').contents().find(".isDisable").val(data.isDisable==1?"启用":"禁用");
                }
            });
        }
    })
</script>
</body>
</html>